#include "MemMan.h"
#include <locale>

MEMMAN_API void MmInitialize();
MEMMAN_API void MmDeInitialize();
MEMMAN_API void MmReInitialize();
MEMMAN_API bool MmIsInitialized();

MEMMAN_API unsigned GetThreadsCountTotal();
MEMMAN_API unsigned GetThreadIndexForId(short threadId);
MEMMAN_API short GetThreadIdForIndex(unsigned threadIdx);
MEMMAN_API unsigned GetThreadEventsCount(unsigned threadIdx, bool useFilter);

MEMMAN_API int GetEventTime(unsigned threadIdx, unsigned eventIdx, bool useFilter);
MEMMAN_API char GetEventType(unsigned threadIdx, unsigned eventIdx, bool useFilter);
MEMMAN_API char* GetEventService(unsigned threadIdx, unsigned eventIdx, bool useFilter);
MEMMAN_API char* GetEventMessage(unsigned threadIdx, unsigned eventIdx, bool useFilter);
MEMMAN_API void GetEventMessageEx(unsigned threadIdx, unsigned eventIdx, char* outBuffer, bool useFilter);
MEMMAN_API void GetEventTimeEx(unsigned threadIdx, unsigned eventIdx, char* outBuffer, bool useFilter);

MEMMAN_API void AddString(LPCSTR data);
MEMMAN_API unsigned AddBlock(LPSTR data, unsigned length);

MEMMAN_API void FilterAddType(char* data);
MEMMAN_API void FilterAddService(char* data);
MEMMAN_API void FilterClear();
MEMMAN_API void FilterApply(unsigned threadIdx);
MEMMAN_API unsigned FilterGetServicesCount();
MEMMAN_API char* FilterGetServiceById(unsigned idx);
MEMMAN_API unsigned FilterGetActiveThreadIdx();
MEMMAN_API bool FilterIsActive();

MEMMAN_API unsigned ParseBack(LPCSTR data, unsigned size);
MEMMAN_API unsigned long long TermSearch(unsigned long long searchPos, int direction, char* term, bool shiftAtFirstIteration);

unsigned GetThreadEventsCountWihPossibleFilter(unsigned threadIdx);

CMemMan* _manager;
char searchBuffer[4096];
